import axios from '@/utils/myaxios.js';

export const login = data => {
  return axios({
    method: 'post',
    url: '/login',
    data
  });
};

export const getUserByid = id => {
  return axios({
    url: `/user/${id}`,
    // headers: { 'Authorization': localStorage.getItem('hm_toutiao') }
  });
};

// 编辑用户信息
// 接口类型:【POST】
// 需要验证:【Authorization 】
// 接口地址: /user_update/:id
// id:当前用户id
// data:你想编辑的数据
export const editUser = (id, data) => {
  return axios({
    method: 'post',
    url: `/user_update/${id}`,
    data
  });
};
export const user_follows = (id) => {
  return axios({
    url: `/user_follows/${id}`,
  });
};
export const user_unfollow = (id) => {
  return axios({
    url: `/user_unfollow/${id}`,
  });
};
export const user_followslist = () => {
  return axios({
    url: `/user_follows`,
  });
};
export const user_starlist = () => {
  return axios({
    url: `/user_star`,
  });
};